import { createStore } from 'vuex'
import user from '@/store/module/user.js'
import nav from '@/store/module/nav.js'
import dept from '@/store/module/dept.js'
import roles from '@/store/module/roles.js'
import cache from '@/util/cache.js'
import sonCom from '@/store/module/sonCom.js'
const store = createStore({
  actions: {
    initializationData({ dispatch, commit }) {
      const navList = cache.getCache('jxcms-userNav')
      //要用同步的
      const user = cache.getCache('jxcms-user')
      commit('changeUser', user)
      commit('changeUserNav', navList)
    }
  },
  modules: {
    user,
    nav,
    dept,
    roles,
    sonCom
  }
})

export default store
